#include "log.h"
#include "task.h"
#include "lib_syscall.h"

int first_task_main(void)
{
    int count = 3;
    int pid = getpid();
    pid = fork();
    if (pid == 0) {
        count += 3;
        print_msg("child count %d\n", count);

        char* argv[] = { "arg0", "arg1", "arg2", "arg3" };
        execve("/shell.elf", argv, (char**)0);
    } else if (pid > 0) {
        count -= 1;
        print_msg("parent count: %d\n", count);
        print_msg("child task id: %d\n", pid);
    } else {
        print_msg("fork error\n", 0);
    }

    for ( ; ; ) {
        /** print_msg("task id: %d\n", pid); */
        msleep(1000);
    }
    return 0;
}
